package van.planifolia.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import van.planifolia.annotation.AopTarget;
import van.planifolia.service.UserService;
import van.planifolia.service.impl.UserServiceImplSp;

import javax.annotation.Resource;

/**
 * Created by Intellij IDEA<br>
 *
 * @author Planifolia.Van
 * @version 1.0
 * @date 2022/11/11 16:55
 */
@RestController
public class UserController {
    /**
     * 注入Service层
     */
    @Resource(name = "userService")
    UserService userService;
    @Resource(name = "userServiceSp")
    UserServiceImplSp userServiceImplSp;

    /**
     * 编写Controller方法保存
     * @return 测试结果
     */
    @AopTarget("save")
    @GetMapping("/Save")
    public String save(){
        userService.save();
        return "插入成功";
    }

    /**
     * 编写Controller方法查询
     * @return 测试结果
     */
    @AopTarget("search")
    @GetMapping("/Search")
    public String search(){
        userServiceImplSp.search();
        return "查询成功";
    }

}
